Skip to content

[Don't merge][WIP][Prototype] Add Python instrumentation Labeler #3689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tammy-baylis-swi
Copy link
Contributor

Description

Don't merge please / WIP / Prototype

Adds new a Python instrumentation Labeler, inspired by Go's net/http instrumentation: open-telemetry/opentelemetry-go-contrib#306. It stores KVs added to it in the current context. The add / add_attributes can be called by user's instrumented code manually, or by custom distros.

Labeler could be read by existing instrumentors so that any added KVs are merged into the attributes of metrics being written. In this PR, FlaskInstrumentor does this so that custom attributes are added to the record calls of the new and old duration histograms.

Could address #3405 though with a new class instead of request/response hooks.

Provides foundation for ASGI instrumentor custom metrics, #1801

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • New unit tests
  • Local installation and manual instrumentation of Flask app, as per new doc

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant